package org.jeecg.modules.business.model;

import org.jeecg.modules.business.entity.BusDict;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.model.SysDepartTreeModel;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 字典表 封装树结构的字典的名称的实体类
 * <p>
 *
 * @Author xq
 * @Since 20230308
 *
 */
public class DictIdModel implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private String key;

    /**
     * 主键ID
     */
    private String value;

    /**
     * 字典名称
     */
    private String title;

    List<DictIdModel> children = new ArrayList<>();

    /**
     * 将BusDictTreeModel的部分数据放在该对象当中
     * @param treeModel
     * @return
     */
    public DictIdModel convert(BusDictTreeModel treeModel) {
        this.key = treeModel.getId();
        this.value = treeModel.getId();
        this.title = treeModel.getDictName();
        return this;
    }

    /**
     * 该方法为字典的实现类所使用
     * @param busDict
     * @return
     */
    public DictIdModel convertByBusDict(BusDict busDict) {
        this.key = busDict.getId();
        this.value = busDict.getId();
        this.title = busDict.getDictName();
        return this;
    }

    public List<DictIdModel> getChildren() {
        return children;
    }

    public void setChildren(List<DictIdModel> children) {
        this.children = children;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}
